﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using MKAdminCore.Controllers;
using MKAdminCore.DTO.Web.HomePage.Pandect;
using MKAdminCore.IService.Web.HomePage;

namespace MKAdminCore.Areas.HomePage.Controllers
{
    [Area("HomePage")]
    [Route("HomePage/[controller]/[action]")]
    public class PandectController : BaseMvcController
    {
        private IPandectService _iPandectService;

        public PandectController(IPandectService iPandectService)
        {
            _iPandectService = iPandectService;
        }

        public IActionResult Index()
        {
            return View();
        }

        /// <summary>
        /// 获取首页汇总数据
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public async Task<IActionResult> GetTabContent(GetTabContentParameter parameter)
        {
            var result = await _iPandectService.GetTabContent(parameter);

            return Ok(result);
        }

        [HttpPost]
        public IActionResult DownLoadCodeLog()
        {
            var userInfo = base.GetUserInfo();
            var result = _iPandectService.DownLoadCodeLog(userInfo);
            return Ok(result);
        }
    }
}